﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using Microsoft.Practices.EnterpriseLibrary.Logging;

namespace Obra.Common
{
    public static class Log
    {
        //System.Diagnostics.TraceEventType.Critical;
        //System.Diagnostics.TraceEventType.Error;
        //System.Diagnostics.TraceEventType.Information;
        //System.Diagnostics.TraceEventType.Resume;
        //System.Diagnostics.TraceEventType.Start;
        //System.Diagnostics.TraceEventType.Stop;
        //System.Diagnostics.TraceEventType.Suspend;
        //System.Diagnostics.TraceEventType.Transfer;
        //System.Diagnostics.TraceEventType.Verbose;
        //System.Diagnostics.TraceEventType.Warning;

        /// <summary>
        /// Create a log entry.
        /// </summary>
        /// <param name="message">
        /// Message to log.
        /// </param>
        /// <param name="traceEventType">
        /// Severity of the log entry.
        /// </param>
        /// <param name="categories">
        /// List of potential categories to associate with log entry.
        /// </param>
        /// <returns></returns>
        private static LogEntry Create(
            string message,
            TraceEventType traceEventType,
            params string[] categories)
        {
            LogEntry logEntry = new LogEntry()
            {
                Message = message,
                Severity = traceEventType,
            };

            foreach (string category in categories)
            {
                logEntry.Categories.Add(category);
            }

            return logEntry;
        }

        /// <summary>
        /// Log a debug message.
        /// </summary>
        public static void Debug(
            string message, 
            params string[] categories)
        {
            //Logger.Write(Log.Create(
            //    message,
            //    TraceEventType.Verbose,
            //    categories));
        }
        /// <summary>
        /// Log an error.
        /// </summary>
        public static void Error(
            string message, 
            params string[] categories)
        {
            //Logger.Write(Log.Create(
            //    message,
            //    TraceEventType.Error,
            //    categories));
        }

        /// <summary>
        /// Log an informational message.
        /// </summary>
        public static void Info(
            string message,
            params string[] categories)
        {
            //Logger.Write(Log.Create(
            //    message,
            //    TraceEventType.Information,
            //    categories));
        }

        /// <summary>
        /// Log a warning.
        /// </summary>
        public static void Warn(
            string message, 
            params string[] categories)
        {
            //Logger.Write(Log.Create(
            //    message,
            //    TraceEventType.Warning,
            //    categories));
        }
    }
}
